package com.example.hrms.controller;




import com.example.hrms.entity.*;
import com.example.hrms.service.UserService;
import com.example.hrms.util.GoogleAuthenticator;
import com.example.hrms.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.List;

@Controller
public class CUser {

    @Autowired
    private UserService userService;

    @RequestMapping("show_login")
    public String showUserLogin(HttpServletRequest request, Model model) {
        return "/login";
    }
    @RequestMapping("show_staffMain")
    public String showStaffMain(HttpServletRequest request, Model model) {
        String username=request.getParameter("username");
        StaffPersonalInfo1 staffPersonalInfo=userService.getStaffPersonalInfoByUsername(username);
        model.addAttribute("username",username);
        model.addAttribute("name",staffPersonalInfo.getName());
        model.addAttribute("uid",staffPersonalInfo.getUid());
        return "/staffMain";
    }
    @RequestMapping("update_StaffPwdbyUsername")
    public String updatePwdByUid(HttpServletRequest request, Model model) {
        String username=request.getParameter("username");
        String pwd=request.getParameter("pwd");
        int i = userService.updatePwdByUsername(username, pwd);
        if (i>0){//修改成功
            return "login";
        }else {//修改失败
            return "staffMain";
        }
    }
/*    @RequestMapping("user_login")
    public String UserLogin(HttpServletRequest request, Model model) {
        String username = request.getParameter("username");
        String password = request.getParameter("password");
        System.out.println("Login>>" + username + "|:" + password);
        User user = userService.checkUserLogin(username, password);
        System.out.println("userLogin>>" +user);
        if (user == null) {
            model.addAttribute("loginStatus", 1);
            return "/login";
        } else {
            //System.out.println("userLogin>>"+user.toString());
            //model.addAttribute("sid", student.Sid);
            if (user.getRole_id() == 2) {
                return "/backgroundMain";
            } else {
                return "/staffMain";
            }
        }
        // return "/static/background_login";
    }*/
    @RequestMapping("get_staffInfo")
    @ResponseBody
    public Result getStaffInfo(HttpServletRequest request, Model model) {
        int uid = Integer.valueOf(request.getParameter("uid"));
        StaffInfo user = userService.getStaffInfo(uid);
        Result result=new Result();
        if(user==null) {
            result.setMsg("查询错误");
            result.setStatus(1);
        }else {
            result.setData(user);
            result.setMsg("查询成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("check_role")
    @ResponseBody
    public Result checkRole(HttpServletRequest request, Model model) {
        String username = request.getParameter("username");
        String password = request.getParameter("password");
//        System.out.println("Login>>" + username + "|:" + password);
        User user = userService.checkUserLogin(username, password);
        System.out.println("checkRole>>" +user);
        Result result=new Result();
        if(user==null) {
            result.setMsg("查询错误");
            result.setStatus(1);
        }else {
            //System.out.println("getAllRoomByEid:查询成功");
//            for(int i=0;i<RoomList.size();i++){
//                System.out.println(RoomList.get(i).toString());
//            }
            result.setData(user.getRole_id());
            result.setMsg("查询成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("check_GoogleAuthenticator")
    public String checkGoogleAuthenticator(HttpServletRequest request, Model model) {
        String code = request.getParameter("code");
        System.out.println("checkGoogleAuthenticator>>"+code);
        String key="PP4TYHK3LCMUFH62";


       boolean flag= GoogleAuthenticator.authcode(code,key);
        if (!flag) {
            model.addAttribute("adminLoginStatus", 1);
            return "/login";
        } else {
                return "/backgroundMain";
        }
       // return "/backgroundMain";
    }

    @RequestMapping("refreshPersonalInfo")
    @ResponseBody
    public Result refreshPersonalInfo(HttpServletRequest request, Model model) {
        List<StaffPersonalInfo1> staffPersonalInfo = userService.getAllStaffPersonalInfo();
        Result result=new Result();
        for(int i=0;i<staffPersonalInfo.size();i++){
            System.out.println("refreshPersonalInfo>>"+staffPersonalInfo.get(i).toString());
        }
        if(staffPersonalInfo.size()<=0) {
            result.setMsg("查询错误");
            result.setStatus(1);
        }else {
            result.setData(staffPersonalInfo);
            result.setMsg("查询成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("refreshPersonenlMatter")
    @ResponseBody
    public Result refreshPersonenlMatter(HttpServletRequest request, Model model) {
        List<PersonnelMatterInfo> PersonenlMatterList = userService.getAllPersonenlMatterlInfo();
        Result result=new Result();
        for(int i=0;i<PersonenlMatterList.size();i++){
            System.out.println("refreshPersonenlMatter>>"+PersonenlMatterList.get(i).toString());
        }
        if(PersonenlMatterList.size()<=0) {
            System.out.println("refreshPersonenlMatter>>查询错误");
            result.setMsg("查询错误");
            result.setStatus(1);
        }else {
            result.setData(PersonenlMatterList);
            result.setMsg("查询成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("update_personalInfo")
    @ResponseBody
    public Result updatePersonalInfo(HttpServletRequest request, Model model) {
        int piid = Integer.valueOf(request.getParameter("piid"));
        String name=request.getParameter("name");
        int sex=Integer.valueOf(request.getParameter("sex"));
        String phone=request.getParameter("phone");
        String address=request.getParameter("address");
        String birthday=request.getParameter("birthday");
      int i= userService.updatePersonalInfo(piid,name,sex,phone,address,birthday);
        Result result=new Result();
        if(i<=0) {
            result.setMsg("更新失败");
            result.setStatus(1);
        }else {
            result.setMsg("更新成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("update_personnelMatter")
    @ResponseBody
    public Result updatePersonnelMatter(HttpServletRequest request, Model model) {
        int pmid = Integer.valueOf(request.getParameter("pmid"));

        String joinTime=request.getParameter("joinTime");
        String departmen=request.getParameter("departmen");
        String position=request.getParameter("position");
        int salary = Integer.valueOf(request.getParameter("salary"));
        int isRegular = Integer.valueOf(request.getParameter("isRegular"));
        int i= userService.updatePersonnelMatter(pmid,joinTime,departmen,position,salary,isRegular);
        Result result=new Result();
        if(i<=0) {
            result.setMsg("更新失败");
            result.setStatus(1);
        }else {
            result.setMsg("更新成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("delete_personalInfo")
    @ResponseBody
    public Result deletePersonalInfo(HttpServletRequest request, Model model) {
        int piid = Integer.valueOf(request.getParameter("piid"));
        int i= userService.deletePersonalInfo(piid);
        Result result=new Result();
        if(i<=0) {
            result.setMsg("删除失败");
            result.setStatus(1);
        }else {
            result.setMsg("删除成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("check_username")
    @ResponseBody
    public Result checkUsername(HttpServletRequest request, Model model) {
        String uesrname=request.getParameter("uesrname");
        User i= userService.checkUsername(uesrname);
        Result result=new Result();
        if(i==null) {
            result.setMsg("查询失败");
            result.setStatus(1);
        }else {
            result.setData(i);
            result.setMsg("查询成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("add_staff")
    @ResponseBody
    public Result addStaff(HttpServletRequest request, Model model) throws ParseException {
        String uesrname=request.getParameter("uesrname");
        String password=request.getParameter("password");
        User user=new User(uesrname,password,  new Timestamp(System.currentTimeMillis()),1);
        int u=userService.addUser(user);
        //通过username获取uid
        User NewUser=userService.checkUsername(user.getUsername());
        String name=request.getParameter("name");
        int sex = Integer.valueOf(request.getParameter("sex"));
        String phone=request.getParameter("phone");
        String address=request.getParameter("address");
        String birthday=request.getParameter("birthday");
        String department=request.getParameter("department");
        String position=request.getParameter("position");
        int salary = Integer.valueOf(request.getParameter("salary"));
        int isRegular = Integer.valueOf(request.getParameter("isRegular"));
        StaffPersonalInfo1 NewPersonalInfo=new StaffPersonalInfo1(NewUser.getUid(),name,sex,phone,address,birthday);
        int p1=userService.addPersonalInfo(NewPersonalInfo);
        StaffPersonnelMatter NewPersonnelInfo=new StaffPersonnelMatter(NewUser.getUid(),new Timestamp(System.currentTimeMillis()),department,position,salary,isRegular);
        int p2=userService.addPersonnelMatter(NewPersonnelInfo);
        int i= u+p1+p2;
        Result result=new Result();
        if(i<=2) {
            result.setMsg("添加失败");
            result.setStatus(1);
        }else {
            result.setMsg("添加成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("refreshStaffAccount")
    @ResponseBody
    public Result refreshStaffAccount(HttpServletRequest request, Model model) {
        List<StaffAccountInfo> StaffAccount= userService.getAllStaffAccountInfo();
        Result result=new Result();
        if(StaffAccount.size()==0) {
            result.setMsg("查询失败");
            result.setStatus(1);
        }else {
            result.setData(StaffAccount);
            result.setMsg("查询成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("update_staffAccount")
    @ResponseBody
    public Result updateStaffAccount(HttpServletRequest request, Model model) {
        int uid = Integer.valueOf(request.getParameter("uid"));
        String username=request.getParameter("username");
        String password=request.getParameter("password");
        int i= userService.updateUser(uid,username,password,new Timestamp(System.currentTimeMillis()));
        Result result=new Result();
        if(i<=0) {
            result.setMsg("更新失败");
            result.setStatus(1);
        }else {
            result.setMsg("更新成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("check_GoogleAuthenticatorForAjax")
    @ResponseBody
    public Result checkGoogleAuthenticatorForAjax(HttpServletRequest request, Model model) {
        String code = request.getParameter("code");
        System.out.println("checkGoogleAuthenticator>>"+code);
        String key="PP4TYHK3LCMUFH62";
     boolean flag= GoogleAuthenticator.authcode(code,key);
        Result result=new Result();
        if (!flag) {
            result.setMsg("验证失败");
            result.setStatus(1);
        } else {
            result.setMsg("验证成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("delete_staff")
    @ResponseBody
    public Result deleteStaff(HttpServletRequest request, Model model) {
        int uid = Integer.valueOf(request.getParameter("uid"));
        int i= userService.deleteUser(uid);
        Result result=new Result();
        if(i<=0) {
            result.setMsg("删除失败");
            result.setStatus(1);
        }else {
            result.setMsg("删除成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("refreshStaffRP")
    @ResponseBody
    public Result refreshStaffRP(HttpServletRequest request, Model model) {
        List<RPInfo> RPInfoList= userService.getAllRPInfo();
        Result result=new Result();
        if(RPInfoList.size()==0) {
            result.setMsg("查询失败");
            result.setStatus(1);
        }else {
            result.setData(RPInfoList);
            result.setMsg("查询成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("add_StaffRP")
    @ResponseBody
    public Result addStaffRP(HttpServletRequest request, Model model) {
        int uid=Integer.valueOf(request.getParameter("uid"));
        String type=request.getParameter("type");
        String detail=request.getParameter("detail");
        String time=request.getParameter("time");
        int i= userService.addStaffRP(uid,type,detail,time);
        Result result=new Result();
        if(i<=0) {
            result.setMsg("录入失败");
            result.setStatus(1);
        }else {
            result.setMsg("录入成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("check_StaffID")
    @ResponseBody
    public Result checkStaffID(HttpServletRequest request, Model model) {
        int uid=Integer.valueOf(request.getParameter("uid"));
        User i= userService.checkStaffID(uid);
        Result result=new Result();
        if(i==null) {
            result.setMsg("查询失败");
            result.setStatus(1);
        }else {
            result.setMsg("查询成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("delete_RPInfo")
    @ResponseBody
    public Result deleteRPInfo(HttpServletRequest request, Model model) {
        int rpid = Integer.valueOf(request.getParameter("rpid"));
        int i= userService.deleteRPInfo(rpid);
        Result result=new Result();
        if(i<=0) {
            result.setMsg("删除失败");
            result.setStatus(1);
        }else {
            result.setMsg("删除成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("update_staffRP")
    @ResponseBody
    public Result updateStaffRP(HttpServletRequest request, Model model) {
        int rpid = Integer.valueOf(request.getParameter("rpid"));
        String type=request.getParameter("type");
        String detail=request.getParameter("detail");
        String RPTime=request.getParameter("RPTime");
        int i= userService.updateStaffRP(rpid,type,detail,RPTime);
        Result result=new Result();
        if(i<=0) {
            result.setMsg("更新失败");
            result.setStatus(1);
        }else {
            result.setMsg("更新成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("refreshRoad")
    @ResponseBody
    public Result refreshRoad(HttpServletRequest request, Model model) {
        List<RoadInfo> roadInfos= userService.getAllRoadInfo();
        for(int i=0;i<roadInfos.size();i++){
            System.out.println("refreshRoad>>"+roadInfos.get(i).toString());
        }
        Result result=new Result();
        if(roadInfos.size()==0) {
            result.setMsg("查询失败");
            result.setStatus(1);
        }else {
            result.setData(roadInfos);
            result.setMsg("查询成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("get_allDriver")
    @ResponseBody
    public Result getAllDriver(HttpServletRequest request, Model model) {
        List<DriverInfo> staffPersonnelMatters= userService.getAllDriver();
      /*  for(int i=0;i<roadInfos.size();i++){
            System.out.println("refreshRoad>>"+roadInfos.get(i).toString());
        }*/
        Result result=new Result();
        if(staffPersonnelMatters.size()==0) {
            result.setMsg("查询失败");
            result.setStatus(1);
        }else {
            result.setData(staffPersonnelMatters);
            result.setMsg("查询成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("get_allRoad")
    @ResponseBody
    public Result getAllRoad(HttpServletRequest request, Model model) {
        List<Road_Info> roadInfos= userService.getAllRoad();
      /*  for(int i=0;i<roadInfos.size();i++){
            System.out.println("refreshRoad>>"+roadInfos.get(i).toString());
        }*/
        Result result=new Result();
        if(roadInfos.size()==0) {
            result.setMsg("查询失败");
            result.setStatus(1);
        }else {
            result.setData(roadInfos);
            result.setMsg("查询成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("add_Driver")
    @ResponseBody
    public Result addDriver(HttpServletRequest request, Model model) {
        int rid=Integer.valueOf(request.getParameter("rid"));
        int uid=Integer.valueOf(request.getParameter("uid"));
        String note=request.getParameter("note");
        int pan=userService.findDAByUid(uid);//重复判断
        Result result=new Result();
        if(pan<=0) {
        int i= userService.addDriver(rid,uid,note);
            if(i<=0) {
                result.setMsg("添加失败");
                result.setStatus(1);
            }else {
                result.setMsg("添加成功");
                result.setStatus(0);
            }
        }else {
            result.setMsg("该司机已被分配");
            result.setStatus(1);
        }
        return result;
    }
    @RequestMapping("add_line")
    @ResponseBody
    public Result addLine(HttpServletRequest request, Model model) {
        String roadNumber=request.getParameter("roadNumber");
        String line=request.getParameter("line");
        //System.out.println(roadNumber);
        int pan=userService.findRoadByRoadNumber(roadNumber);//重复判断

        Result result=new Result();
        if(pan<=0) {
            int i= userService.addRoad(roadNumber,line,new Timestamp(System.currentTimeMillis()));
            if(i<=0) {
                result.setMsg("添加失败");
                result.setStatus(1);
            }else {
                result.setMsg("添加成功");
                result.setStatus(0);
            }
        }else {
            result.setMsg("该线路已存在");
            result.setStatus(1);
        }
        return result;
    }
    @RequestMapping("delete_assign")
    @ResponseBody
    public Result deleteAssign(HttpServletRequest request, Model model) {
        int uid = Integer.valueOf(request.getParameter("uid"));
        int rid = Integer.valueOf(request.getParameter("rid"));
        int i= userService.deleteAssign(uid,rid);
        Result result=new Result();
        if(i<=0) {
            result.setMsg("删除失败");
            result.setStatus(1);
        }else {
            result.setMsg("删除成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("delete_Road")
    @ResponseBody
    public Result deleteRoad(HttpServletRequest request, Model model) {
        int rid = Integer.valueOf(request.getParameter("rid"));
        int i= userService.deleteRoad(rid);
        Result result=new Result();
        if(i<=0) {
            result.setMsg("删除失败");
            result.setStatus(1);
        }else {
            result.setMsg("删除成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("update_roadInfo")
    @ResponseBody
    public Result updateRoadInfo(HttpServletRequest request, Model model) {
        int rid = Integer.valueOf(request.getParameter("rid"));
        String roadUnmber=request.getParameter("roadUnmber");
        String line=request.getParameter("line");
        int i= userService.updateRoadInfo(rid,roadUnmber,line,new Timestamp(System.currentTimeMillis()));
        Result result=new Result();
        if(i<=0) {
            result.setMsg("修改失败");
            result.setStatus(1);
        }else {
            result.setMsg("修改成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("update_driverAssign")
    @ResponseBody
    public Result updateDriverAssign(HttpServletRequest request, Model model) {
        int updateLineUid = Integer.valueOf(request.getParameter("updateLineUid"));
        int ruid = Integer.valueOf(request.getParameter("ruid"));
        int uid = Integer.valueOf(request.getParameter("uid"));
        String note=request.getParameter("note");
        int rid = Integer.valueOf(request.getParameter("rid"));
        String roadUnmber=request.getParameter("roadUnmber");
        String line=request.getParameter("line");
        int pan;
        if(updateLineUid==uid){
            pan=0;//原来的uid和获取的一样则跳过判断
        }else {
            pan=userService.findDAByUid(uid);//重复判断
        }

        Result result=new Result();
        if(pan<=0) {
            int i= userService.updateDriverAssign(ruid,uid,note);
            int i1= userService.updateRoadInfo(rid,roadUnmber,line,new Timestamp(System.currentTimeMillis()));
            if(i<=0&&i1<=0) {
                result.setMsg("修改失败");
                result.setStatus(1);
            }else {
                result.setMsg("修改成功");
                result.setStatus(0);
            }
        }else {
            result.setMsg("该司机已被分配");
            result.setStatus(1);
        }
        return result;
    }
    @RequestMapping("get_RPInfoByUid")
    @ResponseBody
    public Result getRPInfoByUid(HttpServletRequest request, Model model) {
        int  uid=Integer.valueOf(request.getParameter("uid"));
        List<StaffRPInfo> staffRPInfos= userService.getRPInfoByUid(uid);
        Result result=new Result();
        if(staffRPInfos.size()==0) {
            result.setMsg("查询失败");
            result.setStatus(1);
        }else {
            result.setData(staffRPInfos);
            result.setMsg("查询成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("get_CLListByUid")
    @ResponseBody
    public Result getCLListByUid(HttpServletRequest request, Model model) {
        int  uid=Integer.valueOf(request.getParameter("uid"));
        List<StaffCL> staffCLS= userService.getCLListByUid(uid);
        Result result=new Result();
        if(staffCLS.size()==0) {
            result.setMsg("查询失败");
            result.setStatus(1);
        }else {
            result.setData(staffCLS);
            result.setMsg("查询成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("get_AllCLInfo")
    @ResponseBody
    public Result getAllCLInfo(HttpServletRequest request, Model model) {
        List<CLInfo> staffCLS= userService.getAllCLInfo();
        Result result=new Result();
        if(staffCLS.size()==0) {
            result.setMsg("查询失败");
            result.setStatus(1);
        }else {
            result.setData(staffCLS);
            result.setMsg("查询成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("add_StaffCL")
    @ResponseBody
    public Result addStaffCL(HttpServletRequest request, Model model) {
        int uid=Integer.valueOf(request.getParameter("uid"));
        String startTime=request.getParameter("startTime");
        String endTime=request.getParameter("endTime");
        String CLtype=request.getParameter("CLtype");
        String CLDetail=request.getParameter("CLDetail");
        int i= userService.addStaffCL(uid,CLtype,startTime,endTime,new Timestamp(System.currentTimeMillis()),CLDetail);
        Result result=new Result();
        if(i<=0) {
            result.setMsg("发起失败");
            result.setStatus(1);
        }else {
            result.setMsg("发起成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("check_CLTime")
    @ResponseBody
    public Result checkCLTime(HttpServletRequest request, Model model) {
        int  uid=Integer.valueOf(request.getParameter("uid"));
        String startTime=request.getParameter("startTime");
        String endTime=request.getParameter("endTime");
        List<StaffCL> staffCLS= userService.checkCLTime(startTime,endTime, uid);
        Result result=new Result();
        if(staffCLS.size()==0) {
            result.setMsg("检验成功");
            result.setStatus(0);
        }else {
            result.setMsg("检验失败");
            result.setStatus(1);
        }
        return result;
    }
    @RequestMapping("delete_StaffCL")
    @ResponseBody
    public Result deleteStaffCL(HttpServletRequest request, Model model) {
        int clid = Integer.valueOf(request.getParameter("clid"));
        int i= userService.deleteStaffCL(clid);
        Result result=new Result();
        if(i<=0) {
            result.setMsg("删除失败");
            result.setStatus(1);
        }else {
            result.setMsg("删除成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("overTimeCheck")
    @ResponseBody
    public Result overTimeCheck(HttpServletRequest request, Model model) {
        int i= userService.overTimeCheck();
        Result result=new Result();
        if(i<=0) {
            result.setMsg("超时检查失败:");
            result.setStatus(1);
        }else {
            result.setMsg("超时检查成功");
            result.setStatus(0);
        }
        return result;
    }
     @RequestMapping("passCL")
    @ResponseBody
    public Result passCL(HttpServletRequest request, Model model) {
         int clid = Integer.valueOf(request.getParameter("clid"));
        int i= userService.passCL(clid);
        Result result=new Result();
        if(i<=0) {
            result.setMsg("审批通过失败:");
            result.setStatus(1);
        }else {
            result.setMsg("审批通过成功");
            result.setStatus(0);
        }
        return result;
    }
     @RequestMapping("refuseCL")
    @ResponseBody
    public Result refuseCL(HttpServletRequest request, Model model) {
         int clid = Integer.valueOf(request.getParameter("clid"));
        int i= userService.refuseCL(clid);
        Result result=new Result();
        if(i<=0) {
            result.setMsg("拒绝审批失败:");
            result.setStatus(1);
        }else {
            result.setMsg("拒绝审批成功");
            result.setStatus(0);
        }
        return result;
    }
    @RequestMapping("get_driverInfo")
    @ResponseBody
    public Result getDriverInfo(HttpServletRequest request, Model model) {
        int uid = Integer.valueOf(request.getParameter("uid"));
        DriverAssignInfo driverAssignInfo = userService.getDriverInfo(uid);
        System.out.println("getDriverInfo>>"+driverAssignInfo);
        Result result=new Result();
        if(driverAssignInfo==null) {
            result.setMsg("查询错误");
            result.setStatus(1);
        }else {
            result.setData(driverAssignInfo);
            result.setMsg("查询成功");
            result.setStatus(0);
        }
        return result;
    }

}